/*
 * @Author: 
 * @Date: 2022-01-26 11:10:58
 * @LastEditors: lqj
 * @LastEditTime: 2022-02-14 15:18:36
 * @Description: 导入css模块
 */
import React, { Component } from 'react'
import HelloCss from './index.module.css'
import {Button} from 'antd'

export default class Hello extends Component {
  state = {
    num: 0
  }
  handleChange = () => {
    // 对象式setState
    // this.setState({ num: this.state.num + 1 }, () => {
    //   console.log(this.state)
    // })
    // 函数式setState
    this.setState((state, props) => {
      return { num: state.num + 1 }
    })
  }
  render() {
    // console.log(this.props)
      return (
        <>
          <div className={HelloCss.title} style={{ color: '#000' }}>Hello, { this.state.num }</div>
          <Button onClick={this.handleChange}>Change</Button>
        </>
      )
   }
}